package 第五题;

public class PC {
    private CPU cpu;
    private HardDisk hd;

    public void setCPU(CPU c) {
        this.cpu = c;
    }

    public void setHardDisk(HardDisk h) {
        this.hd = h;
    }

    public void show() {
        System.out.println("CPU Speed: " + (cpu != null ? cpu.getSpeed() : "Not set") + " MHz");
        System.out.println("Hard Disk Capacity: " + (hd != null ? hd.getAmount() : "Not set") + " GB");
    }
}

